local jwt = require 'resty.jwt'

--获取url参数 http://localhost/?username=1&password=123&serviceName=cwifi-account-100-71-7-228-8003&method=messagePush
local args = ngx.req.get_uri_args()

ngx.ctx.startTime = ngx.now()

for k,v in pairs(args) do
    ngx.log (ngx.ERR,"args :", k,"=", v)
end
--获取url参数
local username = args['username']
local password = args['password']
local serviceName = args['serviceName']
local method = args['method']

ngx.log(ngx.INFO,"username :", username)
ngx.log(ngx.ERR,"password :", password)
ngx.log(ngx.ERR,"serviceName :", serviceName)

--保存serviceName到线程变量
ngx.ctx.serviceName = serviceName
ngx.ctx.method = method

--没有获取到返回500错误 并输出错误消息
if not username or not password then
    ngx.status = 500
    ngx.say('无法获取账号或者密码')
    return ngx.exit(500)
end

-- 验证账号和密码是否正确,如果验证失败则做如下处理
--if not auth_method(username, password) then
--    ngx.status = 401
--    ngx.say('认证失败')
--    return
--end


